package com.zsk.shop.controller.app;

import com.zsk.shop.common.base.BaseResponse;
import com.zsk.shop.common.base.page.BasePageParams;
import com.zsk.shop.model.results.ShopContentListResults;
import com.zsk.shop.service.ShopCollectionService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Ys
 * @date 2021年12月21日 15:12
 */
@RestController
@Api(tags = "商城-收藏相关")
@RequestMapping("/shop/collection")
public class ShopCollectionController {

    @Resource
    private ShopCollectionService collectionService;

    @PostMapping("/getUserCollectionList.do")
    @ApiOperation(value = "收藏列表")
    public BaseResponse<List<ShopContentListResults>> getUserCollectionList(@RequestBody BasePageParams params) {
        return collectionService.getUserCollectionList(params);
    }

    @GetMapping("/saveCollection.do")
    @ApiOperation(value = "添加收藏")
    @ApiImplicitParams({@ApiImplicitParam(name = "goodsOrderType", value = "1 普通，2 0元购，3 会员商城, 4 特殊"),
            @ApiImplicitParam(name = "goodsNo", value = "商品No")})
    public BaseResponse saveCollection(String goodsNo, Integer goodsOrderType) {
        return collectionService.saveCollection(goodsNo, goodsOrderType);
    }

    @GetMapping("/cancelCollection.do")
    @ApiOperation(value = "取消收藏")
    @ApiImplicitParams({@ApiImplicitParam(name = "goodsOrderType", value = "1 普通，2 0元购，3 会员商城, 4 特殊"),
            @ApiImplicitParam(name = "goodsNo", value = "商品No")})
    public BaseResponse cancelCollection(String goodsNo, Integer goodsOrderType) {
        return collectionService.cancelCollection(goodsNo, goodsOrderType);
    }

}
